<template>
  <div>
    <el-row>
      <el-col :span="24">
        <div class="grid-content bg-purple-dark">
          搜索
        </div>
      </el-col>
    </el-row>
    <div style="display: flex;justify-content: center;align-content: space-around">
      <el-row>
        <el-col :span="24">
          <div class="grid-content bg-purple-dark">
            <el-table
                :data="tableData"
                style="width: 100%">
              <el-table-column
                  prop="orderId"
                  label="订单编号"
                  width="180">
              </el-table-column>
              <el-table-column
                  prop="movieName"
                  label="电影名称"
                  width="180">
              </el-table-column>
              <el-table-column
                  prop="startTime"
                  label="放映时间"
                  width="180">
              </el-table-column>
              <el-table-column
                  prop="price"
                  label="价格">
              </el-table-column>
              <el-table-column
                  prop="count"
                  label="购买数量">
              </el-table-column>
            </el-table>
          </div>
        </el-col>
      </el-row>
    </div>
    <el-row>
      <el-col :span="24">
        <div class="grid-content bg-purple-dark">
          <div class="block">
            <!--            <span class="demonstration">页数较少时的效果</span>-->
            <el-pagination
                layout="prev, pager, next"
                :page-size=pageSize
                :current-page=currentPage
                :total=totalSize
                @current-change="currentPageFn">
            </el-pagination>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "ShowOrder",
  data() {
    return {
      tableData: [],
      totalSize: 0,//总行数
      pageSize: 4,//当前显示数据条数
      currentPage: 1//当前页码
    }
  },
  mounted() {
    this.showAllOrder()
  },
  methods: {
    currentPageFn(currentPage) {
      this.currentPage = currentPage
      this.showAllOrder()
    },
    showAllOrder: function () {
      let url = "orderApi/order/findByPage/" + this.currentPage + "/" + this.pageSize;
      this.axios.get(url).then(
          r => {
            console.log(r.data)
            this.tableData = r.data.records
            this.totalSize = r.data.total
            // this.$router.go(0)
          }
      )
    }
  }
}
</script>

<style scoped>

</style>